#include "libcbgl32memory.h"
#include "group.h"
#include "Group_t.h"
#include "GroupItem_t.h"

CBGL32MEMORYAPI void* cbgl_memory_allocate(size_t n, const char* file, int line)
{
	void* group = mem_Group_create(file, line);
	void* p = mem_Group_allocate(group, n);
	mem_Group_release(group);
	return p;
}

CBGL32MEMORYAPI void cbgl_memory_free(void* p)
{
	if(p)
	{
		GroupItem_t* item = (GroupItem_t*)((char*)p - BLOCK_HEADER_SIZE);
		mem_Group_free(item->group, p, item->size);
	}
}
